<?php

namespace frontend\controllers;

use yii\rest\ActiveController;
use yii\web\Response;

class ArticleController extends ActiveController {
    public $modelClass = 'frontend\models\Article';
    public $serializer = [
        'class' => 'yii\rest\Serializer',
        'collectionEnvelope' => 'articles',
    ];

    public function behaviors()
    {
        $behaviors = parent::behaviors();
        $behaviors['contentNegotiator']['formats']['text/html'] = Response::FORMAT_JSON;
        return $behaviors;
    }

}